-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/serial/serial.c: adapt to the iovec-based api #14898
Conversation
[Experimental Bot, please feedback here] Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary. No, this PR does not fully meet the NuttX requirements. While it provides a summary and mentions testing, it lacks crucial details. Here's a breakdown of missing information:
Specifically, the author needs to:
|
b94fb12
to
2937e17
Compare
a reminder to myself: i have to look at the ci failure. |
it was because of a wrong assertion. i removed the assertion. |
rv-virt/citest64 failure looks like a stack overflow. |
i was able to reproduce the crash with today's master on local qemu. |
* Make readv/writev implementations update struct uio This can simplify partial result handling. * change the error number on the overflow from EOVERFLOW to EINVAL to match NetBSD * add a commented out uio_offset field. I used "#if 0" here as C comments can't nest. * add a few helper functions Note on uio_copyfrom/uio_copyto: although i'm not quite happy with the "offset" functionality, it's necessary to simplify the adaptation of some drivers like drivers/serial/serial.c, which (ab)uses the user-supplied buffer as a line-buffer.
This would fix readv/writev issues mentioned in apache#12674. (only for this specific driver though. with this approach, we basically have to fix every single drivers and filesystems.) Lightly tested on the serial console, using micropython REPL on toywasm with esp32s3-devkit:toywasm, which used to be suffered by the readv issue.
@yamt Can you share what problem you want to resolve with this patch? I am plan to revert this PR. serial device is not suitable for using uio to implement 1 byte copy, It’s too complicate. |
I don't understand the problem you mentioned in your other PR, or can you give me some code examples? |
IMO, it's simpler than having two cases.
#12674 (comment) |
@yamt setup micro-python is too heavy for me. Can you share some specific code or the calling point of readv in micro-python? |
So the root cause is, if using readv to read 2 vector buffers, the second read will block and cannot exit, right? |
@yamt please help to review PR #15604 whether is works for you |
yes. |
Summary
drivers/serial/serial.c: adapt to the iovec-based api
This would fix readv/writev issues mentioned in
#12674.
(only for this specific driver though. with this approach,
we basically have to fix every single drivers and
filesystems.)
Impact
Testing
Lightly tested on the serial console, using micropython REPL
on toywasm with esp32s3-devkit:toywasm, which used to be
suffered by the readv issue.